<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<title>查看所有用户</title>
<link rel="stylesheet" href="../bootstrap/css/bootstrap.min.css">
<script type="text/javascript" src="../js/jquery-3.2.1.min.js"></script>
<script type="text/javascript" src="../bootstrap/js/bootstrap.min.js"></script>
</head>
<body>
	<div class=" panel panel-warning ">
		<div class="panel-heading">
			<h3 class="panel-title">查看所有用户</h3>
		</div>
		<div class="panel-body">
			<table id="tbUserManager" class="table table-striped table-hover">
				<tr>
					<th>序号</th>
					<th>用户名</th>
					<th>密码</th>
					<th>姓名</th>
					<th>昵称</th>
					<th>性别</th>
					<th>年龄</th>
					<th>邮箱</th>
					<th>电话</th>
					<th>个人说明</th>
				</tr>
			</table>
		</div>
	</div>
	<script type="text/javascript">
		$(function() {
			var username;
			$.ajax({
				url : "../usersession",
				async : false,
				type : "GET"
			}).done(function(result) {
				username = result;
			});
			if(username==""){
				window.location.href="noauthority.html";
				return;
			}
			$.ajax({
				url : "../user",
				type : "GET"
			}).done(function(users) {
				for (var i = 0; i < users.length; i++) {
					addUser(users[i]);
				}
			});
		});

		function addUser(user) {
			$("<tr></tr>").append($("<td></td>").text(user.id)).append(
					$("<td></td>").text(user.username)).append(
					$("<td></td>").text(user.password)).append(
					$("<td></td>").text(user.name)).append(
					$("<td></td>").text(user.nic)).append(
					$("<td></td>").text(user.sex)).append(
					$("<td></td>").text(user.age)).append(
					$("<td></td>").text(user.email)).append(
					$("<td></td>").text(user.phone)).append(
					$("<td></td>").text(user.selfshow)).appendTo(
					"#tbUserManager");
		}
	</script>
</body>
</html>